﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace DevExpress.Demos.DemoCenter
{
    public partial class SelectorControl : DevExpress.XtraEditors.XtraUserControl
    {
        LabelEx lblEx = null;
        MyPictureBox myPictureBox = null;
        RadioGroup radioGroup = null;
        PanelControl panelControl = null;

        public SelectorControl()
        {
            InitializeComponent();
            //添加控件
            AddQuestionsControl();
        }


        /// <summary>
        /// 添加控件
        /// </summary>
        public void AddQuestionsControl()
        {
          
            lblEx = new LabelEx();
            lblEx.AutoResizeParent = false;
            lblEx.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            lblEx.Location = new System.Drawing.Point(19, 9);
            lblEx.Name = "lblEx";
            lblEx.Width = 560;
            lblEx.Text = "一、中国共产党人对待马克思主义唯一正确和科学的态度是( ).";
            lblEx.Click += new EventHandler(lblEx_Click);
            this.Controls.Add(lblEx);

            myPictureBox = new MyPictureBox();
            myPictureBox.Location = new System.Drawing.Point(19, lblEx.Location.Y+lblEx.Height+5);
            myPictureBox.Name = "myPictureBox";
            myPictureBox.Properties.Appearance.BackColor = System.Drawing.Color.Transparent;
            myPictureBox.Properties.Appearance.Options.UseBackColor = true;
            myPictureBox.Properties.Appearance.Options.UseBorderColor = true;
            myPictureBox.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
            myPictureBox.Size = new System.Drawing.Size(200, 160);
            myPictureBox.TabIndex = 12;
            myPictureBox.MouseEnter += new System.EventHandler(this.myPictureBox3_MouseEnter);
            myPictureBox.MouseLeave += new System.EventHandler(this.myPictureBox3_MouseLeave);
            myPictureBox.Image = Image.FromFile(@"form-main-bg.png");

            this.Controls.Add(myPictureBox);

            radioGroup = new RadioGroup();
            radioGroup.Dock = System.Windows.Forms.DockStyle.Fill;
            radioGroup.Location = new System.Drawing.Point(19, myPictureBox.Location.Y + myPictureBox.Height + 5);
            radioGroup.Name = "radioGroup";
            radioGroup.Properties.Appearance.BackColor = System.Drawing.Color.Transparent;
            radioGroup.Properties.Appearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(237)))), ((int)(((byte)(237)))));
            radioGroup.Properties.Appearance.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            radioGroup.Properties.Appearance.Options.UseBackColor = true;
            radioGroup.Properties.Appearance.Options.UseBorderColor = true;
            radioGroup.Properties.Appearance.Options.UseFont = true;
            radioGroup.Properties.AppearanceFocused.BorderColor = System.Drawing.Color.White;
            radioGroup.Properties.AppearanceFocused.Options.UseBorderColor = true;
            radioGroup.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
            radioGroup.Properties.Items.AddRange(new DevExpress.XtraEditors.Controls.RadioGroupItem[] {
                new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "A、坚持马克思主义基本原理与中国具体实际相结合"),
                new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "B、坚持维护马克思主义的原创性"),
                new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "C、靠引证马克思关于某一问题的某一论证来解决问题"),
                new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "D、马克思主义理论是神圣不可侵犯的")});
            radioGroup.MouseEnter += new System.EventHandler(this.radioGroup1_MouseEnter);
            radioGroup.MouseLeave += new System.EventHandler(this.radioGroup1_MouseLeave);

            //,
            //    new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "D、选项四"),
            //    new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "D、选项四"),
            //    new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "D、选项四"),
            //    new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "D、选项四"),
            //    new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "D、选项四"),
            //    new DevExpress.XtraEditors.Controls.RadioGroupItem(null, "D、选项四")

            panelControl = new PanelControl();
            panelControl.Appearance.BackColor = System.Drawing.Color.Transparent;
            panelControl.Appearance.BackColor2 = System.Drawing.Color.Transparent;
            panelControl.Appearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(237)))), ((int)(((byte)(237)))));
            panelControl.Appearance.ForeColor = System.Drawing.Color.Transparent;
            panelControl.Appearance.Options.UseBackColor = true;
            panelControl.Appearance.Options.UseBorderColor = true;
            panelControl.Appearance.Options.UseForeColor = true;
            panelControl.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple;
            panelControl.Controls.Add(this.radioGroup);
            panelControl.Location = new System.Drawing.Point(19, myPictureBox.Location.Y + myPictureBox.Height + 5);
            panelControl.Name = "panelControl";
            panelControl.Width = 560;
            panelControl.Height = radioGroup.Height;
            panelControl.MouseLeave += new System.EventHandler(this.panelControl1_MouseLeave);
            panelControl.MouseEnter += new System.EventHandler(this.panelControl1_MouseEnter);

            this.Controls.Add(panelControl);
            this.Height = panelControl.Location.Y + panelControl.Height;
        }

        void lblEx_Click(object sender, EventArgs e)
        {
            this.lblEx.Parent.Parent.Focus();
        }

        private void myPictureBox3_MouseEnter(object sender, EventArgs e)
        {
            this.myPictureBox.Properties.Appearance.BorderColor = Color.FromArgb(255, 188, 98);
            this.myPictureBox.Cursor = Cursors.Hand;
        }

        private void myPictureBox3_MouseLeave(object sender, EventArgs e)
        {
            this.myPictureBox.Properties.Appearance.BorderColor = Color.White;
        }

        private void memoEdit1_MouseEnter(object sender, EventArgs e)
        {
            //this.memoEdit1.Properties.AppearanceReadOnly.BorderColor = Color.FromArgb(255, 188, 98);
        }

        private void memoEdit1_MouseLeave(object sender, EventArgs e)
        {
            //this.memoEdit1.Properties.AppearanceReadOnly.BorderColor = Color.White;
        }

        private void radioGroup1_MouseEnter(object sender, EventArgs e)
        {
            this.radioGroup.Properties.Appearance.BorderColor = Color.FromArgb(255, 188, 98);
        }

        private void radioGroup1_MouseLeave(object sender, EventArgs e)
        {
            this.radioGroup.Properties.Appearance.BorderColor = Color.FromArgb(237,237,237);
        }

        private void radioGroup1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.radioGroup.Properties.Appearance.BorderColor = Color.FromArgb(255, 188, 98);
        
        }

        private void panelControl1_MouseEnter(object sender, EventArgs e)
        {
            this.panelControl.Appearance.BorderColor = Color.FromArgb(255, 188, 98);
        }

        private void panelControl1_MouseLeave(object sender, EventArgs e)
        {
            this.panelControl.Appearance.BorderColor = Color.FromArgb(237, 237, 237);
        }

        private void SelectorControl_Click(object sender, EventArgs e)
        {
            this.Parent.Focus();
        }


    }
}
